<template>
  <div class="wrapper">
    <div class="uc-main clearfix">
      <div class="uc-aside">
        <user-menu></user-menu>
      </div>
      <div class="uc-content">
        <div class="uc-panel">
          <div class="uc-bigtit">修改密码</div>
          <div class="uc-panel-bd">
            <div class="account-info clearfix" >
            <el-form class="col-userinfo"  ref="form" :model="form" label-width="80px">
              <el-form-item  label="原密码">
                <el-input style="width: 320px" type="password" class="bd" v-model="form.usedPassword"></el-input>
              </el-form-item>
              <el-form-item  label="新密码">
                <el-input style="width: 320px" type="password" class="bd" v-model="password.password"></el-input>
              </el-form-item>
              <el-form-item  label="确认密码">
                <el-input style="width: 320px" type="password" class="bd" v-model="password.confirmPassword"></el-input>
              </el-form-item>
              <el-button style="background: #ff0000; color: #ffffff; width: 320px" class="tj" type="submit" @click="modifyPassword">修改</el-button>
            </el-form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import UserMenu from './UserMenu'
import http from '../../../base/api/http'
export default {
  name: 'UserPasswordWrapper',
  components: {
    UserMenu
  },
  data () {
    return {
      form: {
        usedPassword: null,
        password: null
      },
      password: {
        password: '',
        confirmPassword: ''
      }
    }
  },
  methods: {
    modifyPassword () {
      if (this.password.password === this.password.confirmPassword) {
        this.form.password = this.password.password
        http.requestPost('/java/api/user/userPasswordModify', this.form).then((res) => {
          if (res.status === 0) {
            alert('修改成功')
          } else {
            alert(res.msg)
          }
        })
      } else {
        alert('两次密码不一致')
      }
    }
  },
  mounted () {

  }
}
</script>
<style></style>
